package zerous.infinite.screen;
import com.badlogic.gdx.*;
import com.badlogic.gdx.graphics.*;
import com.badlogic.gdx.graphics.g2d.*;
import com.badlogic.gdx.scenes.scene2d.*;
import zerous.infinite.*;
import zerous.infinite.core.entity.*;
import zerous.infinite.ui.*;
import zerous.infinite.util.*;
import zerous.infinite.core.*;
import com.badlogic.gdx.scenes.scene2d.ui.*;

public class GameScreen extends ScreenAdapter
{
	Rocker rocker;
	Button attack;
	Batch debugBatch;
	Stage stage;
	
	GameWorld gameWorld;
	
	public GameScreen() {
		
	}

	@Override
	public void show() {
		// TODO: Implement this method
		super.show();
		rocker = new Rocker(Assets.ROCKER_LIMIT.getWidth()*3f, Assets.ROCKER_LIMIT.getHeight()*3f);
		attack = new Button();
		gameWorld = new GameWorld();
		debugBatch = new SpriteBatch();
		stage = new Stage();
		gameWorld.getPlayer().setController(rocker);
		stage.addActor(rocker);
		Gdx.input.setInputProcessor(stage);
	}

	@Override
	public void render(float delta) {
		super.render(delta);
		gameWorld.update(delta);
		
		Gdx.gl.glClearColor(0.5f, 0.5f, 0.5f, 1);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		
		gameWorld.draw();
		
		debugBatch.begin();
		Assets.fnt.draw(debugBatch, "啊啊啊啊", Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2);
		debugBatch.end();
		
		stage.act();
		stage.draw();
	}

	@Override
	public void dispose() {
		super.dispose();
		stage.dispose();
	}
}
